package com.nulgame.bukkit.plugin.messagebuilder;

import com.nulgame.bukkit.plugin.responsebuilder.AntiIPAddressResponseBuilder;

import junit.framework.TestCase;

public class AntiIPAddressResponseBuilderTestCase extends TestCase {
	public void testToResponse(){
		String responseFormat = "An IP address is not allowed.";
		String playerName = "chicanh";
		String message ="This is a ip 192.168.95.225";
		String ip = "192.168.95.225";
		AntiIPAddressResponseBuilder builder = new AntiIPAddressResponseBuilder(responseFormat, playerName, message, ip);
		assertEquals("An IP address is not allowed.", builder.toResponse());
		
		responseFormat = "%PlayerName%, your message is %Message% contains ip %IP% is not allowed.";
		builder = new AntiIPAddressResponseBuilder(responseFormat, playerName, message, ip);
		assertEquals("chicanh, your message is This is a ip 192.168.95.225 contains ip 192.168.95.225 is not allowed.", builder.toResponse());
		
		responseFormat = null;
		builder = new AntiIPAddressResponseBuilder(responseFormat, playerName, message, ip);
		assertNull(builder.toResponse());
	}
}
